import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/views/index/index'
import Login from '@/views/login/login'
import Register from '@/views/login/register'
import GetBackPassword from '@/views/login/getBack'
import UserCenter from '@/views/personalCenter/personCenter'

import Article from '@/views/article/index.vue'
import Test from '../views/Test/menu.vue'
import ArticleRelease from '../views/personalCenter/components/createArticle.vue'
import UserInfo from '../views/personalCenter/components/info.vue'
import ArticleList from '../views/personalCenter/components/articleList.vue'
import FansList from '../views/personalCenter/components/MyFansList.vue'
import ReleaseCommont from '../views/personalCenter/components/releaseCommont.vue'
import UserList from '../views/manager/userList.vue'
import LoggerList from '../views/manager/loggerList.vue'


import MainPage from '../views/mainPage/index.vue'

Vue.use(Router)

export default new Router({
  // vue中去掉url地址栏中的#符号
  mode:'history',
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index
    }
    ,{
      path: '/user/login',
      name: 'Login',
      component: Login
    },{
      path: '/user/register',
      name: 'Register',
      component: Register
    },{
      path: '/user/backPass',
      name: 'GetBackPassword',
      component: GetBackPassword
    },{
      path: '/user/article/:id',
      name: 'Article',
      component: Article
    },{
      path: '/user/main/:id',
      component: MainPage
    },{
      path: '/test',
      name: 'Test',
      component: Test
    },{
      path:'/manager',
      component:UserCenter,
      children:[
        {
          path:'/user/card',
          component:UserInfo,
          meta:{
            requireAuth: true,
          },
        },
        {
          path:'/user/modifiy',
          component:UserInfo,
          meta:{
            requireAuth: true,
          },
        },
        {
          path:'/article/release',
          component:ArticleRelease,
          meta:{
            requireAuth: true,
          },
        },
        {
          path:'/article/list',
          component:ArticleList,
          meta:{
            requireAuth: true,
          },
        },
        {
          path:'/user/fans',
          component:FansList,
          meta:{
            requireAuth: true,
          },
        },{
          path:'/manager/userList',
          component:UserList,
          meta:{
            requireAuth: true,
          },
        },{
          path:'/manager/loggerList',
          component:LoggerList,
          meta:{
            requireAuth: true,
          }
        },{
          path:'/commont/release',
          component:ReleaseCommont,
          meta:{
            requireAuth: true,
          },
        }
      ]
    }
  ]
})


// ,{
//       path: '/user/center',
//       // alias: '/user/Modfiy',
//       // alias: '/article/list',
//       // alias: '/article/release',
//       meta:{
//         requireAuth: true,   // 添加该字段，表示进入这个路由是需要登录的
//       },
//       name: 'UserCenter',
//       component: UserCenter
//     }


// ,{
//       path: '/article/release',
//       name: 'ArticleRelease',
//       component: ArticleRelease
//     }


// ,{
    //   path: '/article/list',
    //   alias: '/user/Modfiy',
    //   meta:{
    //     requireAuth: true,   // 添加该字段，表示进入这个路由是需要登录的
    //   },
    //   name: 'UserCenter',
    //   component: UserCenter
    // }
